<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<script type="text/javascript">
	var wsURL = "ws://localhost:8080/ClientActionServlet";
	var id = "null";
	var gameId = "null";

	function endTurn() {
		$('button[id^="btnMove "]').attr('disabled', 'disabled');
		$("#btnPassTurn").attr('disabled', 'disabled');
	}

	function victory(ws) {
		endGame(ws);
		alert("Victory");
	}

	function defeat(ws) {
		endGame(ws);
		alert("Défaite");
	}

	function colorTuile(i, j, color) {
		$("button[id^='btnMove " + i + " " + j + "']").parent().css(
				'background-color', color);
	}

	function endGame(ws) {
		ws.close();
		$("button[id^='btnMove ']").parent().css('background-color', 'white');
		hideAllTiles();
		gameId = -1;
		id = -1;
		$("#btnQuitGame").attr('disabled', 'disabled');
		$("#btnJoinGame").removeAttr('disabled');
	}

	function begTurn() {
		$('button[id^="btnMove "]').removeAttr('disabled');
		$("#btnPassTurn").removeAttr('disabled');
	}

	function hideAllTiles() {
		$('button[id^="btnMove "]').css('visibility', 'hidden');
	}

	function setApPoint(mr) {
		$("#actionPoint").html(mr + "/10");
	}

	function setInfoLegion(p, x, y, c1, c2, c3, c4) {
		$("#poids").html(p);
		$("#x").html(x);
		$("#y").html(y);
		$("#guerriers").html(c1);
		$("#archers").html(c2);
		$("#chevaliers").html(c3);
		$("#toruks").html(c4);
	}

	function showLocal(x, y) {
		hideAllTiles();
		$("button[id='btnMove " + (x + 1) + " " + y + "']").css('visibility',
				'visible');
		$("button[id='btnMove " + (x - 1) + " " + y + "']").css('visibility',
				'visible');
		$("button[id='btnMove " + x + " " + (y + 1) + "']").css('visibility',
				'visible');
		$("button[id='btnMove " + x + " " + (y - 1) + "']").css('visibility',
				'visible');
	}

	function startAt(x, y) {
		showLocal(parseInt(x), parseInt(y));
	}

	function showOpponent(x, y) {
		$("button[id^='btnMove ']").parent().css('background-image', '');
		$("button[id='btnMove " + x + " " + y + "']").parent().css(
				'background-image', 'url("images/ennemy.png")');
		bindTooltipToLegion(x, y);
	}

	function move(x, y) {
		if ("WebSocket" in window) {
			var ws = new WebSocket(wsURL);
			ws.onopen = function() {
				ws.send("move " + gameId + " " + id + " " + x + " " + y);
			};

			ws.onmessage = function(evt) {
				var mr = evt.data;
				mr = mr.split(" ")
				switch (mr[0]) {
				case "moveOK":
					showLocal(parseInt(mr[1]), parseInt(mr[2]));
					break;
				case "undoMove":
					break;
				case "passOK":
					ws.close();
				case "AP":
					setApPoint(mr[1]);
					break;
				case "LI":
					setInfoLegion(mr[1], mr[2], mr[3], mr[4], mr[5], mr[6],
							mr[7]);
					break;
				case "gameOver":
					endGame(ws);
					break;
				}
			};
		}
	}

	function quitGame() {
		var ws = new WebSocket(wsURL);

		ws.onopen = function() {
			ws.send("quit " + gameId + " " + id);
		};

		ws.onmessage = function(evt) {
			var mr = evt.data;
			mr = mr.split(" ");
			switch (mr[0]) {
			case "quitOK":
				ws.close();
				break;
			}
		};
	}

	function passTurn() {
		if ("WebSocket" in window) {
			var ws = new WebSocket(wsURL);

			ws.onopen = function() {
				ws.send("pass " + gameId);
			};
			endTurn();
		} else
			alert("Web Sockets are not supported by your browser.");

	}

	function joinGame() {
		if ("WebSocket" in window) {
			var ws = new WebSocket(wsURL);

			ws.onopen = function() {
				ws.send("join");
			};

			ws.onmessage = function(evt) {
				var mr = evt.data;
				mr = mr.split(" ");
				switch (mr[0]) {
				case "subscribedOK":
					gameId = mr[1];
					id = mr[2];
					break;
				case "startOK": // changer pour plusieurs legion
					startAt(mr[3], mr[4]);
					break;
				case "opponentPosition":
					showOpponent(mr[3], mr[4]);
					break;
				case "goOK":
					begTurn();
					break;
				case "mapTuile":
					colorTuile(mr[1], mr[2], mr[3]);
					break;
				case "Victory":
					victory(ws);
				case "AP":
					setApPoint(mr[1]);
					break;
				case "LI":
					setInfoLegion(mr[1], mr[2], mr[3], mr[4], mr[5], mr[6],
							mr[7]);
					break;
				case "Defeat":
					defeat(ws);
					break;
				}
			};
		}

		else
			alert("Web Sockets are not supported by your browser.");
	}

	function bindTooltipToLegion(x, y) {

		$("td").off();

		var changeTooltipPosition = function(event) {
			var tooltipX = event.pageX - 8;
			var tooltipY = event.pageY + 8;
			$('div.tooltipLegion').css({
				top : tooltipY,
				left : tooltipX
			});
		};

		var showTooltip = function(event) {
			$('div.tooltipLegion').remove();
			$('<div class="tooltipLegion">  HEY   </div>').appendTo('body');
			changeTooltipPosition(event);
		};

		var hideTooltip = function() {
			$('div.tooltipLegion').remove();
		};

		$("button[id='btnMove " + x + " " + y + "']").parent().on({
			mousemove : changeTooltipPosition,
			mouseenter : showTooltip,
			mouseleave : hideTooltip
		});
	}

	$(document).ready(
			function() {
				$('button[id^="btnMove "]').attr('disabled', 'disabled');

				$('button[id^="btnMove "]').click(
						function() {
							move($(this).attr("id").split(" ")[1], $(this)
									.attr("id").split(" ")[2]);
						});

				$("#btnJoinGame").click(function() {
					joinGame();
					$(this).attr('disabled', 'disabled');
					$("#btnQuitGame").removeAttr('disabled');
					$("#btnPassTurn").removeAttr('disabled');
				});

				$("#btnPassTurn").click(function() {
					passTurn();
				});

				$("#btnQuitGame").click(function() {
					quitGame();
				});
			});
</script>






<style type="text/css">
button[id^="btnMove "] {
	visibility: hidden;
}

body {
	background-color: lightgray;
}

}
.tooltipLegion {
	margin: 8px;
	padding: 8px;
	border: 1px solid blue;
	background-color: yellow;
	position: absolute;
	z-index: 2;
}
</style>



<title">Risk Game v1.2</title>
</head>
<body>

	<h1>Bienvenue</h1>


	<button id="btnJoinGame" type="button">Rejoindre partie</button>
	<button id="btnQuitGame" disabled="disabled" type="button">Quitter
		Partie</button>
	<button id="btnPassTurn" disabled="disabled" type="button">Passer
		tour</button>

	<table align="right" border="1" cellspacing="0" width="200">
			<tr>
			<td>Infos Legion</td>
		</tr>
		
		<tr>
			<td>Pts d'action:</td>
			<td><div id="actionPoint"></div></td>
		</tr>
		<tr>
			<td>Poids:</td>
			<td><div id="poids"></div></td>
		</tr>
		<tr><td>X:</td>
			<td><div id="x"></div></td>
		</tr>
		<tr><td>Y:</td>
			<td><div id="y"></div></td>
		</tr>
		<tr><td>Nb Guerriers:</td>
			<td><div id="guerriers"></div></td>
		</tr>
		<tr><td>Nb Archers:</td>
			<td><div id="archers"></div></td>
		</tr>
		<tr><td>Nb Chevaliers:</td>
			<td><div id="chevaliers"></div></td>
		</tr>
		<tr><td>Nb Toruks:</td>
			<td><div id="toruks"></div></td>
		</tr>
		</tr>
	</table>

	<table id="board" border="1" align="center"cellspacing="0">
		<tr>
			<td><button id="btnMove 0 0" type="button">GO</button></td>
			<td><button id="btnMove 0 1" type="button">GO</button></td>
			<td><button id="btnMove 0 2" type="button">GO</button></td>
			<td><button id="btnMove 0 3" type="button">GO</button></td>
			<td><button id="btnMove 0 4" type="button">GO</button></td>
			<td><button id="btnMove 0 5" type="button">GO</button></td>
			<td><button id="btnMove 0 6" type="button">GO</button></td>
			<td><button id="btnMove 0 7" type="button">GO</button></td>
			<td><button id="btnMove 0 8" type="button">GO</button></td>
			<td><button id="btnMove 0 9" type="button">GO</button></td>
			<td><button id="btnMove 0 10" type="button">GO</button></td>
			<td><button id="btnMove 0 11" type="button">GO</button></td>
			<td><button id="btnMove 0 12" type="button">GO</button></td>
			<td><button id="btnMove 0 13" type="button">GO</button></td>
			<td><button id="btnMove 0 14" type="button">GO</button></td>
			<td><button id="btnMove 0 15" type="button">GO</button></td>
			<td><button id="btnMove 0 16" type="button">GO</button></td>
			<td><button id="btnMove 0 17" type="button">GO</button></td>
			<td><button id="btnMove 0 18" type="button">GO</button></td>
			<td><button id="btnMove 0 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 1 0" type="button">GO</button></td>
			<td><button id="btnMove 1 1" type="button">GO</button></td>
			<td><button id="btnMove 1 2" type="button">GO</button></td>
			<td><button id="btnMove 1 3" type="button">GO</button></td>
			<td><button id="btnMove 1 4" type="button">GO</button></td>
			<td><button id="btnMove 1 5" type="button">GO</button></td>
			<td><button id="btnMove 1 6" type="button">GO</button></td>
			<td><button id="btnMove 1 7" type="button">GO</button></td>
			<td><button id="btnMove 1 8" type="button">GO</button></td>
			<td><button id="btnMove 1 9" type="button">GO</button></td>
			<td><button id="btnMove 1 10" type="button">GO</button></td>
			<td><button id="btnMove 1 11" type="button">GO</button></td>
			<td><button id="btnMove 1 12" type="button">GO</button></td>
			<td><button id="btnMove 1 13" type="button">GO</button></td>
			<td><button id="btnMove 1 14" type="button">GO</button></td>
			<td><button id="btnMove 1 15" type="button">GO</button></td>
			<td><button id="btnMove 1 16" type="button">GO</button></td>
			<td><button id="btnMove 1 17" type="button">GO</button></td>
			<td><button id="btnMove 1 18" type="button">GO</button></td>
			<td><button id="btnMove 1 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 2 0" type="button">GO</button></td>
			<td><button id="btnMove 2 1" type="button">GO</button></td>
			<td><button id="btnMove 2 2" type="button">GO</button></td>
			<td><button id="btnMove 2 3" type="button">GO</button></td>
			<td><button id="btnMove 2 4" type="button">GO</button></td>
			<td><button id="btnMove 2 5" type="button">GO</button></td>
			<td><button id="btnMove 2 6" type="button">GO</button></td>
			<td><button id="btnMove 2 7" type="button">GO</button></td>
			<td><button id="btnMove 2 8" type="button">GO</button></td>
			<td><button id="btnMove 2 9" type="button">GO</button></td>
			<td><button id="btnMove 2 10" type="button">GO</button></td>
			<td><button id="btnMove 2 11" type="button">GO</button></td>
			<td><button id="btnMove 2 12" type="button">GO</button></td>
			<td><button id="btnMove 2 13" type="button">GO</button></td>
			<td><button id="btnMove 2 14" type="button">GO</button></td>
			<td><button id="btnMove 2 15" type="button">GO</button></td>
			<td><button id="btnMove 2 16" type="button">GO</button></td>
			<td><button id="btnMove 2 17" type="button">GO</button></td>
			<td><button id="btnMove 2 18" type="button">GO</button></td>
			<td><button id="btnMove 2 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 3 0" type="button">GO</button></td>
			<td><button id="btnMove 3 1" type="button">GO</button></td>
			<td><button id="btnMove 3 2" type="button">GO</button></td>
			<td><button id="btnMove 3 3" type="button">GO</button></td>
			<td><button id="btnMove 3 4" type="button">GO</button></td>
			<td><button id="btnMove 3 5" type="button">GO</button></td>
			<td><button id="btnMove 3 6" type="button">GO</button></td>
			<td><button id="btnMove 3 7" type="button">GO</button></td>
			<td><button id="btnMove 3 8" type="button">GO</button></td>
			<td><button id="btnMove 3 9" type="button">GO</button></td>
			<td><button id="btnMove 3 10" type="button">GO</button></td>
			<td><button id="btnMove 3 11" type="button">GO</button></td>
			<td><button id="btnMove 3 12" type="button">GO</button></td>
			<td><button id="btnMove 3 13" type="button">GO</button></td>
			<td><button id="btnMove 3 14" type="button">GO</button></td>
			<td><button id="btnMove 3 15" type="button">GO</button></td>
			<td><button id="btnMove 3 16" type="button">GO</button></td>
			<td><button id="btnMove 3 17" type="button">GO</button></td>
			<td><button id="btnMove 3 18" type="button">GO</button></td>
			<td><button id="btnMove 3 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 4 0" type="button">GO</button></td>
			<td><button id="btnMove 4 1" type="button">GO</button></td>
			<td><button id="btnMove 4 2" type="button">GO</button></td>
			<td><button id="btnMove 4 3" type="button">GO</button></td>
			<td><button id="btnMove 4 4" type="button">GO</button></td>
			<td><button id="btnMove 4 5" type="button">GO</button></td>
			<td><button id="btnMove 4 6" type="button">GO</button></td>
			<td><button id="btnMove 4 7" type="button">GO</button></td>
			<td><button id="btnMove 4 8" type="button">GO</button></td>
			<td><button id="btnMove 4 9" type="button">GO</button></td>
			<td><button id="btnMove 4 10" type="button">GO</button></td>
			<td><button id="btnMove 4 11" type="button">GO</button></td>
			<td><button id="btnMove 4 12" type="button">GO</button></td>
			<td><button id="btnMove 4 13" type="button">GO</button></td>
			<td><button id="btnMove 4 14" type="button">GO</button></td>
			<td><button id="btnMove 4 15" type="button">GO</button></td>
			<td><button id="btnMove 4 16" type="button">GO</button></td>
			<td><button id="btnMove 4 17" type="button">GO</button></td>
			<td><button id="btnMove 4 18" type="button">GO</button></td>
			<td><button id="btnMove 4 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 5 0" type="button">GO</button></td>
			<td><button id="btnMove 5 1" type="button">GO</button></td>
			<td><button id="btnMove 5 2" type="button">GO</button></td>
			<td><button id="btnMove 5 3" type="button">GO</button></td>
			<td><button id="btnMove 5 4" type="button">GO</button></td>
			<td><button id="btnMove 5 5" type="button">GO</button></td>
			<td><button id="btnMove 5 6" type="button">GO</button></td>
			<td><button id="btnMove 5 7" type="button">GO</button></td>
			<td><button id="btnMove 5 8" type="button">GO</button></td>
			<td><button id="btnMove 5 9" type="button">GO</button></td>
			<td><button id="btnMove 5 10" type="button">GO</button></td>
			<td><button id="btnMove 5 11" type="button">GO</button></td>
			<td><button id="btnMove 5 12" type="button">GO</button></td>
			<td><button id="btnMove 5 13" type="button">GO</button></td>
			<td><button id="btnMove 5 14" type="button">GO</button></td>
			<td><button id="btnMove 5 15" type="button">GO</button></td>
			<td><button id="btnMove 5 16" type="button">GO</button></td>
			<td><button id="btnMove 5 17" type="button">GO</button></td>
			<td><button id="btnMove 5 18" type="button">GO</button></td>
			<td><button id="btnMove 5 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 6 0" type="button">GO</button></td>
			<td><button id="btnMove 6 1" type="button">GO</button></td>
			<td><button id="btnMove 6 2" type="button">GO</button></td>
			<td><button id="btnMove 6 3" type="button">GO</button></td>
			<td><button id="btnMove 6 4" type="button">GO</button></td>
			<td><button id="btnMove 6 5" type="button">GO</button></td>
			<td><button id="btnMove 6 6" type="button">GO</button></td>
			<td><button id="btnMove 6 7" type="button">GO</button></td>
			<td><button id="btnMove 6 8" type="button">GO</button></td>
			<td><button id="btnMove 6 9" type="button">GO</button></td>
			<td><button id="btnMove 6 10" type="button">GO</button></td>
			<td><button id="btnMove 6 11" type="button">GO</button></td>
			<td><button id="btnMove 6 12" type="button">GO</button></td>
			<td><button id="btnMove 6 13" type="button">GO</button></td>
			<td><button id="btnMove 6 14" type="button">GO</button></td>
			<td><button id="btnMove 6 15" type="button">GO</button></td>
			<td><button id="btnMove 6 16" type="button">GO</button></td>
			<td><button id="btnMove 6 17" type="button">GO</button></td>
			<td><button id="btnMove 6 18" type="button">GO</button></td>
			<td><button id="btnMove 6 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 7 0" type="button">GO</button></td>
			<td><button id="btnMove 7 1" type="button">GO</button></td>
			<td><button id="btnMove 7 2" type="button">GO</button></td>
			<td><button id="btnMove 7 3" type="button">GO</button></td>
			<td><button id="btnMove 7 4" type="button">GO</button></td>
			<td><button id="btnMove 7 5" type="button">GO</button></td>
			<td><button id="btnMove 7 6" type="button">GO</button></td>
			<td><button id="btnMove 7 7" type="button">GO</button></td>
			<td><button id="btnMove 7 8" type="button">GO</button></td>
			<td><button id="btnMove 7 9" type="button">GO</button></td>
			<td><button id="btnMove 7 10" type="button">GO</button></td>
			<td><button id="btnMove 7 11" type="button">GO</button></td>
			<td><button id="btnMove 7 12" type="button">GO</button></td>
			<td><button id="btnMove 7 13" type="button">GO</button></td>
			<td><button id="btnMove 7 14" type="button">GO</button></td>
			<td><button id="btnMove 7 15" type="button">GO</button></td>
			<td><button id="btnMove 7 16" type="button">GO</button></td>
			<td><button id="btnMove 7 17" type="button">GO</button></td>
			<td><button id="btnMove 7 18" type="button">GO</button></td>
			<td><button id="btnMove 7 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 8 0" type="button">GO</button></td>
			<td><button id="btnMove 8 1" type="button">GO</button></td>
			<td><button id="btnMove 8 2" type="button">GO</button></td>
			<td><button id="btnMove 8 3" type="button">GO</button></td>
			<td><button id="btnMove 8 4" type="button">GO</button></td>
			<td><button id="btnMove 8 5" type="button">GO</button></td>
			<td><button id="btnMove 8 6" type="button">GO</button></td>
			<td><button id="btnMove 8 7" type="button">GO</button></td>
			<td><button id="btnMove 8 8" type="button">GO</button></td>
			<td><button id="btnMove 8 9" type="button">GO</button></td>
			<td><button id="btnMove 8 10" type="button">GO</button></td>
			<td><button id="btnMove 8 11" type="button">GO</button></td>
			<td><button id="btnMove 8 12" type="button">GO</button></td>
			<td><button id="btnMove 8 13" type="button">GO</button></td>
			<td><button id="btnMove 8 14" type="button">GO</button></td>
			<td><button id="btnMove 8 15" type="button">GO</button></td>
			<td><button id="btnMove 8 16" type="button">GO</button></td>
			<td><button id="btnMove 8 17" type="button">GO</button></td>
			<td><button id="btnMove 8 18" type="button">GO</button></td>
			<td><button id="btnMove 8 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 9 0" type="button">GO</button></td>
			<td><button id="btnMove 9 1" type="button">GO</button></td>
			<td><button id="btnMove 9 2" type="button">GO</button></td>
			<td><button id="btnMove 9 3" type="button">GO</button></td>
			<td><button id="btnMove 9 4" type="button">GO</button></td>
			<td><button id="btnMove 9 5" type="button">GO</button></td>
			<td><button id="btnMove 9 6" type="button">GO</button></td>
			<td><button id="btnMove 9 7" type="button">GO</button></td>
			<td><button id="btnMove 9 8" type="button">GO</button></td>
			<td><button id="btnMove 9 9" type="button">GO</button></td>
			<td><button id="btnMove 9 10" type="button">GO</button></td>
			<td><button id="btnMove 9 11" type="button">GO</button></td>
			<td><button id="btnMove 9 12" type="button">GO</button></td>
			<td><button id="btnMove 9 13" type="button">GO</button></td>
			<td><button id="btnMove 9 14" type="button">GO</button></td>
			<td><button id="btnMove 9 15" type="button">GO</button></td>
			<td><button id="btnMove 9 16" type="button">GO</button></td>
			<td><button id="btnMove 9 17" type="button">GO</button></td>
			<td><button id="btnMove 9 18" type="button">GO</button></td>
			<td><button id="btnMove 9 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 10 0" type="button">GO</button></td>
			<td><button id="btnMove 10 1" type="button">GO</button></td>
			<td><button id="btnMove 10 2" type="button">GO</button></td>
			<td><button id="btnMove 10 3" type="button">GO</button></td>
			<td><button id="btnMove 10 4" type="button">GO</button></td>
			<td><button id="btnMove 10 5" type="button">GO</button></td>
			<td><button id="btnMove 10 6" type="button">GO</button></td>
			<td><button id="btnMove 10 7" type="button">GO</button></td>
			<td><button id="btnMove 10 8" type="button">GO</button></td>
			<td><button id="btnMove 10 9" type="button">GO</button></td>
			<td><button id="btnMove 10 10" type="button">GO</button></td>
			<td><button id="btnMove 10 11" type="button">GO</button></td>
			<td><button id="btnMove 10 12" type="button">GO</button></td>
			<td><button id="btnMove 10 13" type="button">GO</button></td>
			<td><button id="btnMove 10 14" type="button">GO</button></td>
			<td><button id="btnMove 10 15" type="button">GO</button></td>
			<td><button id="btnMove 10 16" type="button">GO</button></td>
			<td><button id="btnMove 10 17" type="button">GO</button></td>
			<td><button id="btnMove 10 18" type="button">GO</button></td>
			<td><button id="btnMove 10 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 11 0" type="button">GO</button></td>
			<td><button id="btnMove 11 1" type="button">GO</button></td>
			<td><button id="btnMove 11 2" type="button">GO</button></td>
			<td><button id="btnMove 11 3" type="button">GO</button></td>
			<td><button id="btnMove 11 4" type="button">GO</button></td>
			<td><button id="btnMove 11 5" type="button">GO</button></td>
			<td><button id="btnMove 11 6" type="button">GO</button></td>
			<td><button id="btnMove 11 7" type="button">GO</button></td>
			<td><button id="btnMove 11 8" type="button">GO</button></td>
			<td><button id="btnMove 11 9" type="button">GO</button></td>
			<td><button id="btnMove 11 10" type="button">GO</button></td>
			<td><button id="btnMove 11 11" type="button">GO</button></td>
			<td><button id="btnMove 11 12" type="button">GO</button></td>
			<td><button id="btnMove 11 13" type="button">GO</button></td>
			<td><button id="btnMove 11 14" type="button">GO</button></td>
			<td><button id="btnMove 11 15" type="button">GO</button></td>
			<td><button id="btnMove 11 16" type="button">GO</button></td>
			<td><button id="btnMove 11 17" type="button">GO</button></td>
			<td><button id="btnMove 11 18" type="button">GO</button></td>
			<td><button id="btnMove 11 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 12 0" type="button">GO</button></td>
			<td><button id="btnMove 12 1" type="button">GO</button></td>
			<td><button id="btnMove 12 2" type="button">GO</button></td>
			<td><button id="btnMove 12 3" type="button">GO</button></td>
			<td><button id="btnMove 12 4" type="button">GO</button></td>
			<td><button id="btnMove 12 5" type="button">GO</button></td>
			<td><button id="btnMove 12 6" type="button">GO</button></td>
			<td><button id="btnMove 12 7" type="button">GO</button></td>
			<td><button id="btnMove 12 8" type="button">GO</button></td>
			<td><button id="btnMove 12 9" type="button">GO</button></td>
			<td><button id="btnMove 12 10" type="button">GO</button></td>
			<td><button id="btnMove 12 11" type="button">GO</button></td>
			<td><button id="btnMove 12 12" type="button">GO</button></td>
			<td><button id="btnMove 12 13" type="button">GO</button></td>
			<td><button id="btnMove 12 14" type="button">GO</button></td>
			<td><button id="btnMove 12 15" type="button">GO</button></td>
			<td><button id="btnMove 12 16" type="button">GO</button></td>
			<td><button id="btnMove 12 17" type="button">GO</button></td>
			<td><button id="btnMove 12 18" type="button">GO</button></td>
			<td><button id="btnMove 12 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 13 0" type="button">GO</button></td>
			<td><button id="btnMove 13 1" type="button">GO</button></td>
			<td><button id="btnMove 13 2" type="button">GO</button></td>
			<td><button id="btnMove 13 3" type="button">GO</button></td>
			<td><button id="btnMove 13 4" type="button">GO</button></td>
			<td><button id="btnMove 13 5" type="button">GO</button></td>
			<td><button id="btnMove 13 6" type="button">GO</button></td>
			<td><button id="btnMove 13 7" type="button">GO</button></td>
			<td><button id="btnMove 13 8" type="button">GO</button></td>
			<td><button id="btnMove 13 9" type="button">GO</button></td>
			<td><button id="btnMove 13 10" type="button">GO</button></td>
			<td><button id="btnMove 13 11" type="button">GO</button></td>
			<td><button id="btnMove 13 12" type="button">GO</button></td>
			<td><button id="btnMove 13 13" type="button">GO</button></td>
			<td><button id="btnMove 13 14" type="button">GO</button></td>
			<td><button id="btnMove 13 15" type="button">GO</button></td>
			<td><button id="btnMove 13 16" type="button">GO</button></td>
			<td><button id="btnMove 13 17" type="button">GO</button></td>
			<td><button id="btnMove 13 18" type="button">GO</button></td>
			<td><button id="btnMove 13 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 14 0" type="button">GO</button></td>
			<td><button id="btnMove 14 1" type="button">GO</button></td>
			<td><button id="btnMove 14 2" type="button">GO</button></td>
			<td><button id="btnMove 14 3" type="button">GO</button></td>
			<td><button id="btnMove 14 4" type="button">GO</button></td>
			<td><button id="btnMove 14 5" type="button">GO</button></td>
			<td><button id="btnMove 14 6" type="button">GO</button></td>
			<td><button id="btnMove 14 7" type="button">GO</button></td>
			<td><button id="btnMove 14 8" type="button">GO</button></td>
			<td><button id="btnMove 14 9" type="button">GO</button></td>
			<td><button id="btnMove 14 10" type="button">GO</button></td>
			<td><button id="btnMove 14 11" type="button">GO</button></td>
			<td><button id="btnMove 14 12" type="button">GO</button></td>
			<td><button id="btnMove 14 13" type="button">GO</button></td>
			<td><button id="btnMove 14 14" type="button">GO</button></td>
			<td><button id="btnMove 14 15" type="button">GO</button></td>
			<td><button id="btnMove 14 16" type="button">GO</button></td>
			<td><button id="btnMove 14 17" type="button">GO</button></td>
			<td><button id="btnMove 14 18" type="button">GO</button></td>
			<td><button id="btnMove 14 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 15 0" type="button">GO</button></td>
			<td><button id="btnMove 15 1" type="button">GO</button></td>
			<td><button id="btnMove 15 2" type="button">GO</button></td>
			<td><button id="btnMove 15 3" type="button">GO</button></td>
			<td><button id="btnMove 15 4" type="button">GO</button></td>
			<td><button id="btnMove 15 5" type="button">GO</button></td>
			<td><button id="btnMove 15 6" type="button">GO</button></td>
			<td><button id="btnMove 15 7" type="button">GO</button></td>
			<td><button id="btnMove 15 8" type="button">GO</button></td>
			<td><button id="btnMove 15 9" type="button">GO</button></td>
			<td><button id="btnMove 15 10" type="button">GO</button></td>
			<td><button id="btnMove 15 11" type="button">GO</button></td>
			<td><button id="btnMove 15 12" type="button">GO</button></td>
			<td><button id="btnMove 15 13" type="button">GO</button></td>
			<td><button id="btnMove 15 14" type="button">GO</button></td>
			<td><button id="btnMove 15 15" type="button">GO</button></td>
			<td><button id="btnMove 15 16" type="button">GO</button></td>
			<td><button id="btnMove 15 17" type="button">GO</button></td>
			<td><button id="btnMove 15 18" type="button">GO</button></td>
			<td><button id="btnMove 15 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 16 0" type="button">GO</button></td>
			<td><button id="btnMove 16 1" type="button">GO</button></td>
			<td><button id="btnMove 16 2" type="button">GO</button></td>
			<td><button id="btnMove 16 3" type="button">GO</button></td>
			<td><button id="btnMove 16 4" type="button">GO</button></td>
			<td><button id="btnMove 16 5" type="button">GO</button></td>
			<td><button id="btnMove 16 6" type="button">GO</button></td>
			<td><button id="btnMove 16 7" type="button">GO</button></td>
			<td><button id="btnMove 16 8" type="button">GO</button></td>
			<td><button id="btnMove 16 9" type="button">GO</button></td>
			<td><button id="btnMove 16 10" type="button">GO</button></td>
			<td><button id="btnMove 16 11" type="button">GO</button></td>
			<td><button id="btnMove 16 12" type="button">GO</button></td>
			<td><button id="btnMove 16 13" type="button">GO</button></td>
			<td><button id="btnMove 16 14" type="button">GO</button></td>
			<td><button id="btnMove 16 15" type="button">GO</button></td>
			<td><button id="btnMove 16 16" type="button">GO</button></td>
			<td><button id="btnMove 16 17" type="button">GO</button></td>
			<td><button id="btnMove 16 18" type="button">GO</button></td>
			<td><button id="btnMove 16 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 17 0" type="button">GO</button></td>
			<td><button id="btnMove 17 1" type="button">GO</button></td>
			<td><button id="btnMove 17 2" type="button">GO</button></td>
			<td><button id="btnMove 17 3" type="button">GO</button></td>
			<td><button id="btnMove 17 4" type="button">GO</button></td>
			<td><button id="btnMove 17 5" type="button">GO</button></td>
			<td><button id="btnMove 17 6" type="button">GO</button></td>
			<td><button id="btnMove 17 7" type="button">GO</button></td>
			<td><button id="btnMove 17 8" type="button">GO</button></td>
			<td><button id="btnMove 17 9" type="button">GO</button></td>
			<td><button id="btnMove 17 10" type="button">GO</button></td>
			<td><button id="btnMove 17 11" type="button">GO</button></td>
			<td><button id="btnMove 17 12" type="button">GO</button></td>
			<td><button id="btnMove 17 13" type="button">GO</button></td>
			<td><button id="btnMove 17 14" type="button">GO</button></td>
			<td><button id="btnMove 17 15" type="button">GO</button></td>
			<td><button id="btnMove 17 16" type="button">GO</button></td>
			<td><button id="btnMove 17 17" type="button">GO</button></td>
			<td><button id="btnMove 17 18" type="button">GO</button></td>
			<td><button id="btnMove 17 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 18 0" type="button">GO</button></td>
			<td><button id="btnMove 18 1" type="button">GO</button></td>
			<td><button id="btnMove 18 2" type="button">GO</button></td>
			<td><button id="btnMove 18 3" type="button">GO</button></td>
			<td><button id="btnMove 18 4" type="button">GO</button></td>
			<td><button id="btnMove 18 5" type="button">GO</button></td>
			<td><button id="btnMove 18 6" type="button">GO</button></td>
			<td><button id="btnMove 18 7" type="button">GO</button></td>
			<td><button id="btnMove 18 8" type="button">GO</button></td>
			<td><button id="btnMove 18 9" type="button">GO</button></td>
			<td><button id="btnMove 18 10" type="button">GO</button></td>
			<td><button id="btnMove 18 11" type="button">GO</button></td>
			<td><button id="btnMove 18 12" type="button">GO</button></td>
			<td><button id="btnMove 18 13" type="button">GO</button></td>
			<td><button id="btnMove 18 14" type="button">GO</button></td>
			<td><button id="btnMove 18 15" type="button">GO</button></td>
			<td><button id="btnMove 18 16" type="button">GO</button></td>
			<td><button id="btnMove 18 17" type="button">GO</button></td>
			<td><button id="btnMove 18 18" type="button">GO</button></td>
			<td><button id="btnMove 18 19" type="button">GO</button></td>
		</tr>
		<tr>
			<td><button id="btnMove 19 0" type="button">GO</button></td>
			<td><button id="btnMove 19 1" type="button">GO</button></td>
			<td><button id="btnMove 19 2" type="button">GO</button></td>
			<td><button id="btnMove 19 3" type="button">GO</button></td>
			<td><button id="btnMove 19 4" type="button">GO</button></td>
			<td><button id="btnMove 19 5" type="button">GO</button></td>
			<td><button id="btnMove 19 6" type="button">GO</button></td>
			<td><button id="btnMove 19 7" type="button">GO</button></td>
			<td><button id="btnMove 19 8" type="button">GO</button></td>
			<td><button id="btnMove 19 9" type="button">GO</button></td>
			<td><button id="btnMove 19 10" type="button">GO</button></td>
			<td><button id="btnMove 19 11" type="button">GO</button></td>
			<td><button id="btnMove 19 12" type="button">GO</button></td>
			<td><button id="btnMove 19 13" type="button">GO</button></td>
			<td><button id="btnMove 19 14" type="button">GO</button></td>
			<td><button id="btnMove 19 15" type="button">GO</button></td>
			<td><button id="btnMove 19 16" type="button">GO</button></td>
			<td><button id="btnMove 19 17" type="button">GO</button></td>
			<td><button id="btnMove 19 18" type="button">GO</button></td>
			<td><button id="btnMove 19 19" type="button">GO</button></td>
		</tr>
	</table>



</body>
</html>